package com.kevinkk.dp;

import java.util.Arrays;

/**
 * 给定一个未经排序的整数数组，找到最长且 连续递增的子序列，并返回该序列的长度。
 */

public class LongestContinuousIncreasingSubsequence {
    class Solution {
        public int findLengthOfLCIS(int[] nums) {
            int length = nums.length;
            int[] dp = new int[length];
            Arrays.fill(dp, 1);
            int res = 1;
            for (int i = 1; i < length; i++) {
                // 只能和前一个进行比较
                if(nums[i] > nums[i-1]) dp[i] = dp[i-1]+1;
                res = Math.max(res, dp[i]);
            }
            return res;
        }
    }
}
